import book.BookList;

import users.AdminUser;
import users.PublicUser;
import users.User;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: wangj
 * Date: 2022-02-28
 * Time: 20:50
 */
public class Main {
    public static User login(){
        System.out.println("请输入姓名：");
        Scanner scan=new Scanner(System.in);
        String name=scan.nextLine();
        System.out.println("请输入你的身份：1.管理员 0.普通用户");
        int choice=scan.nextInt();
        if(choice==1){
            return new AdminUser(name);
        }else {
            return new PublicUser(name);
        }
    }
    public static void main(String[] args) {
        BookList bookList=new BookList();
        User user=login();
//        user 1.管理员的对象 0.普通用户对象
        while(true) {
            int choice = user.menu();
//        根据choice完成哪个对象的哪个操作
            user.doOperation(choice, bookList);
        }
    }
}
